
//回显数据，填充表格
function setFormValue(obj) {
    // console.log(obj);
    let data = obj.data;
    let status_value = true;
    if (data.status === 2) {
        status_value = false;
    }


//图片
    $('#imageLists').val()
    $('#subjectimg img').remove()
    $('#imageLists').append("[")
    var str="[";
    let arry=[];
var id=1;
    if(data.imageLists!=null&&data.imageLists!="") {
        $('#subjectimg').children().remove()
        $(data.imageLists).each(function (index, item) {
id+=1;
            $('#subjectimg').append('<div><div id='+id+'><img src=' + item.imageUrl + '  name="' + item.name + '" style="width:50px; height:50px; display:block; " /></div><a class=" delete-btn">删除</a></div>');
            str += "{'name':'" + item.name + "','imageUrl':'" + item.imageUrl + "'},";

        });
        str = str.substr(0, str.length - 1);

        if(str!=null&&str!=""){
            str += "]"
        }

    $('#imageLists').val(str)
    }

    $('#recording').val()

    //录音
    var strs="[";
    if(data.recording!=null&&data.recording!=""){
        $('#subjectrecord').children().remove()
    // $(data.recording).each(function (index, item) {
        $('#subjectrecord').append('<audio controls   style=" width: 70px;height:30px;"  > <source  type="audio/ogg" src='+data.recording.recordingUrl+' id="" name=""  /> </audio> &nbsp;');
        strs+="{'name':'"+data.recording.name+"','recordingUrl':'"+data.recording.recordingUrl+"'},";
    // });
    strs=strs.substr(0,strs.length-1);
        if(strs!=""&&strs!=null){
            strs+="]"
        }
    $('#recording').val(strs)
    }

    //视频
    var strss="[";
    var videos=[];
    $('#videoLists').val()

    if(data.videoLists!=null&&data.videoLists!=""){
        $('#subjectvideo').children().remove()
    $(data.videoLists).each(function (index, item) {
        $('#subjectvideo').append('<div><div id='+id+'><video controls="controls"  id='+item.id+'  style=" width: 100px;height:100px;" > <source  type="video/mp4" src='+item.videoUrl+' id="" name="" style=\\"width:100px; height:100px; display:block; " /> </video>&nbsp;</div><a class=" delete-btn">删除</a></div>');
        strss+="{'name':'"+item.name+"','videoUrl':'"+item.videoUrl+"'},";
        // videos.push({"name":item.name,"videoUrl":item.videoUrl})
    });
    strss=strss.substr(0,strss.length-1);
        if(strss!=""&&strss!=null){
            strss+="]"
        }
    $('#videoLists').val(strss)
    }



///笔画视频
    $('#strokeOrder').val()
    $('#subjectvideos video source').remove()
    //音频
    var strs="[";
    if(data.strokes!=null&&data.strokes!=""){
        $(data.strokes).each(function (index, item) {
            $('#subjectvideos').append('<audio controls  id='+item.id+' style=" width: 70px;height:30px;"  > <source  type="audio/ogg" src='+item.recordingUrl+' id="" name=""  /> </audio> &nbsp;');

            strs+="{'name':'"+item.name+"','recordingUrl':'"+item.recordingUrl+"'},";
        });
        strs=strs.substr(0,strs.length-1);
        if(strs!=""&&strs!=null){
            strs+="]"
        }
        $('#strokeOrder').val(strs)
    }



    form.val("languageEditFilter", {
        "prefix": data.prefix
        , "id": data.id
        , "pinyin": data.pinyin
        , "strokes": data.strokes
        ,"strokeOrder":data.strokeOrder
        ,"recording":data.recording
        ,"pinyinIndex":data.pinyinIndex
        ,"radicalIndex":data.radicalIndex
        ,"language":data.language
        ,"statusv":data.convType
        ,'hsk':data.hsk
        ,"part":data.part
        ,"phrase":data.phrase
        ,"interpretation":data.interpretation
        ,"sentence":data.sentence
        ,"pinyin":data.pinyin
        ,"interpretationTranslate":data.interpretationTranslate
        ,"similar":data.similar
        ,"antonym":data.antonym
        //
        // // ,"rightEntrys":data.rightKey
        // ,'chooseA':data.chooses[0]==null?null:data.chooses[0].text
        // ,'chooseB':data.chooses[1]==null?null:data.chooses[1].text
        // ,'chooseC':data.chooses[2]==null?null:data.chooses[2].text
        // ,'chooseD':data.chooses[3]==null?null:data.chooses[3].text




    });
    form.render();
}